package cn.lijian.goods.pager;

import java.util.List;

/**
 * 分页 bean ,它会在各层之间传递
 * @author lijian
 *
 * @param <T>
 */
public class PageBean<T> {

	private int pageCurrent;//当前页码
	private int totalRecord;//总记录数
	private int pageSize;//每页记录数
	private String url;//请求路径和参数
	private List<T>beanList;
	private int totalPages;
	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	//计算总页数
	public int getTotalPages(){
		int totalPages=totalRecord/pageSize;
		return totalRecord%pageSize==0?totalPages:totalPages+1;
	}
	
	public PageBean(int pageCurrent, int totalRecord, int pageSize, String url,
			List<T> beanList) {
		super();
		this.pageCurrent = pageCurrent;
		this.totalRecord = totalRecord;
		this.pageSize = pageSize;
		this.url = url;
		this.beanList = beanList;
	}

	public PageBean() {
		super();
		// TODO Auto-generated constructor stub
	}

	public int getPageCurrent() {
		return pageCurrent;
	}

	public void setPageCurrent(int pageCurrent) {
		this.pageCurrent = pageCurrent;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public List<T> getBeanList() {
		return beanList;
	}

	public void setBeanList(List<T> beanList) {
		this.beanList = beanList;
	}

	@Override
	public String toString() {
		return "PageBean [pageCurrent=" + pageCurrent + ", totalRecord="
				+ totalRecord + ", pageSize=" + pageSize + ", url=" + url
				+ ", beanList=" + beanList + ", totalPages=" + totalPages + "]";
	} 
	
	
	
}
